package org.teremail.schema;

public class ColumnBuilder {

    private boolean isPrimaryKey = false;
    private boolean isNullable = false;
    private final String name;
    private final DBType type;

    public ColumnBuilder(String name, DBType type) {
        this.name = name;
        this.type = type;
    }

    public ColumnBuilder primaryKey() {
        isPrimaryKey = true;
        isNullable = false;
        return this;
    }

    public ColumnBuilder nullable(boolean nullable) {
        isNullable = nullable;
        return this;
    }

    public Column build() {
        return new Column(name, type, isPrimaryKey, isNullable);
    }

}
